﻿using System;
using System.Collections.Generic;
using TimeTravel.Components.Enumeration;

namespace TimeTravel.Components
{
    public class PageQueryInfo
    {
        #region Fields

        private int _pageIndex;
        private int _pageSize;

        #endregion

        #region Property

		/// <summary>
        /// 分页索引
        /// </summary>
        public int PageIndex
        {
            get { return _pageIndex; }
            set
            {
                if (value < 0)
                {
                    value = 0;
                }
                _pageIndex = value;
            }
        }
        /// <summary>
        /// 分页大小
        /// </summary>
        public int PageSize 
        {
            get { return _pageSize; }
            set
            {
                if (value <= 0)
                {
                    throw new ArgumentException("value is not valided");
                }
                _pageSize = value;
            }
        }
        /// <summary>
        /// 排序字段
        /// </summary>
        public string OrderBy { get; set; }
        /// <summary>
        /// 排序规则
        /// </summary>
        public SortRuleType OrderRule { get; set; }
        /// <summary>
        /// 条件语句（不带where）
        /// </summary>
        public string Condition { get; set; }
	    #endregion
    }
}
